********************************************
* CONVERT TCN TO BROAD INDUSTRY CATEGORIES *
********************************************

tempvar done iog2003
gen byte `done' = 0
gen int `iog2003' = .
qui replace `iog2003' = 1 if ((!`done') & (tcn >= 100) & (tcn < 200))
qui replace `done' = 1 if ((tcn >= 100) & (tcn < 200))
qui replace `iog2003' = 2 if ((!`done') & (tcn >= 200) & (tcn < 300))
qui replace `done' = 1 if ((tcn >= 200) & (tcn < 300))
qui replace `iog2003' = 3 if ((!`done') & (tcn >= 300) & (tcn < 400))
qui replace `done' = 1 if ((tcn >= 300) & (tcn < 400))
qui replace `iog2003' = 4 if ((!`done') & (tcn >= 400) & (tcn < 402))
qui replace `done' = 1 if ((tcn >= 400) & (tcn < 402))
qui replace `iog2003' = 35 if ((!`done') & (tcn >= 402) & (tcn < 403))
qui replace `done' = 1 if ((tcn >= 402) & (tcn < 403))
qui replace `iog2003' = 4 if ((!`done') & (tcn >= 403) & (tcn < 500))
qui replace `done' = 1 if ((tcn >= 403) & (tcn < 500))
qui replace `iog2003' = 5 if ((!`done') & (tcn >= 500) & (tcn < 600))
qui replace `done' = 1 if ((tcn >= 500) & (tcn < 600))
qui replace `iog2003' = 35 if ((!`done') & (tcn >= 600) & (tcn < 800))
qui replace `done' = 1 if ((tcn >= 600) & (tcn < 800))
qui replace `iog2003' = 86 if ((!`done') & (tcn >= 800) & (tcn < 802))
qui replace `done' = 1 if ((tcn >= 800) & (tcn < 802))
qui replace `iog2003' = 85 if ((!`done') & (tcn >= 802) & (tcn < 900))
qui replace `done' = 1 if ((tcn >= 802) & (tcn < 900))
qui replace `iog2003' = 87 if ((!`done') & (tcn >= 900) & (tcn < 1000))
qui replace `done' = 1 if ((tcn >= 900) & (tcn < 1000))
qui replace `iog2003' = 7 if ((!`done') & (tcn >= 1000) & (tcn < 1004))
qui replace `done' = 1 if ((tcn >= 1000) & (tcn < 1004))
qui replace `iog2003' = 6 if ((!`done') & (tcn >= 1004) & (tcn < 1005))
qui replace `done' = 1 if ((tcn >= 1004) & (tcn < 1005))
qui replace `iog2003' = 7 if ((!`done') & (tcn >= 1005) & (tcn < 1006))
qui replace `done' = 1 if ((tcn >= 1005) & (tcn < 1006))
qui replace `iog2003' = 5 if ((!`done') & (tcn >= 1006) & (tcn < 1007))
qui replace `done' = 1 if ((tcn >= 1006) & (tcn < 1007))
qui replace `iog2003' = 7 if ((!`done') & (tcn >= 1007) & (tcn < 1100))
qui replace `done' = 1 if ((tcn >= 1007) & (tcn < 1100))
qui replace `iog2003' = 54 if ((!`done') & (tcn >= 1100) & (tcn < 1105))
qui replace `done' = 1 if ((tcn >= 1100) & (tcn < 1105))
qui replace `iog2003' = 55 if ((!`done') & (tcn >= 1105) & (tcn < 1108))
qui replace `done' = 1 if ((tcn >= 1105) & (tcn < 1108))
qui replace `iog2003' = 61 if ((!`done') & (tcn >= 1108) & (tcn < 1109))
qui replace `done' = 1 if ((tcn >= 1108) & (tcn < 1109))
qui replace `iog2003' = 55 if ((!`done') & (tcn >= 1109) & (tcn < 1200))
qui replace `done' = 1 if ((tcn >= 1109) & (tcn < 1200))
qui replace `iog2003' = 51 if ((!`done') & (tcn >= 1200) & (tcn < 1202))
qui replace `done' = 1 if ((tcn >= 1200) & (tcn < 1202))
qui replace `iog2003' = 50 if ((!`done') & (tcn >= 1202) & (tcn < 1203))
qui replace `done' = 1 if ((tcn >= 1202) & (tcn < 1203))
qui replace `iog2003' = 49 if ((!`done') & (tcn >= 1203) & (tcn < 1206))
qui replace `done' = 1 if ((tcn >= 1203) & (tcn < 1206))
qui replace `iog2003' = 52 if ((!`done') & (tcn >= 1206) & (tcn < 1207))
qui replace `done' = 1 if ((tcn >= 1206) & (tcn < 1207))
qui replace `iog2003' = 53 if ((!`done') & (tcn >= 1207) & (tcn < 1300))
qui replace `done' = 1 if ((tcn >= 1207) & (tcn < 1300))
qui replace `iog2003' = 37 if ((!`done') & (tcn >= 1300) & (tcn < 1302))
qui replace `done' = 1 if ((tcn >= 1300) & (tcn < 1302))
qui replace `iog2003' = 38 if ((!`done') & (tcn >= 1302) & (tcn < 1303))
qui replace `done' = 1 if ((tcn >= 1302) & (tcn < 1303))
qui replace `iog2003' = 43 if ((!`done') & (tcn >= 1303) & (tcn < 1305))
qui replace `done' = 1 if ((tcn >= 1303) & (tcn < 1305))
qui replace `iog2003' = 44 if ((!`done') & (tcn >= 1305) & (tcn < 1307))
qui replace `done' = 1 if ((tcn >= 1305) & (tcn < 1307))
qui replace `iog2003' = 40 if ((!`done') & (tcn >= 1307) & (tcn < 1309))
qui replace `done' = 1 if ((tcn >= 1307) & (tcn < 1309))
qui replace `iog2003' = 36 if ((!`done') & (tcn >= 1309) & (tcn < 1310))
qui replace `done' = 1 if ((tcn >= 1309) & (tcn < 1310))
qui replace `iog2003' = 39 if ((!`done') & (tcn >= 1310) & (tcn < 1311))
qui replace `done' = 1 if ((tcn >= 1310) & (tcn < 1311))
qui replace `iog2003' = 41 if ((!`done') & (tcn >= 1311) & (tcn < 1312))
qui replace `done' = 1 if ((tcn >= 1311) & (tcn < 1312))
qui replace `iog2003' = 42 if ((!`done') & (tcn >= 1312) & (tcn < 1313))
qui replace `done' = 1 if ((tcn >= 1312) & (tcn < 1313))
qui replace `iog2003' = 45 if ((!`done') & (tcn >= 1313) & (tcn < 1315))
qui replace `done' = 1 if ((tcn >= 1313) & (tcn < 1315))
qui replace `iog2003' = 46 if ((!`done') & (tcn >= 1315) & (tcn < 1316))
qui replace `done' = 1 if ((tcn >= 1315) & (tcn < 1316))
qui replace `iog2003' = 45 if ((!`done') & (tcn >= 1316) & (tcn < 1400))
qui replace `done' = 1 if ((tcn >= 1316) & (tcn < 1400))
qui replace `iog2003' = 64 if ((!`done') & (tcn >= 1400) & (tcn < 1402))
qui replace `done' = 1 if ((tcn >= 1400) & (tcn < 1402))
qui replace `iog2003' = 65 if ((!`done') & (tcn >= 1402) & (tcn < 1403))
qui replace `done' = 1 if ((tcn >= 1402) & (tcn < 1403))
qui replace `iog2003' = 62 if ((!`done') & (tcn >= 1403) & (tcn < 1407))
qui replace `done' = 1 if ((tcn >= 1403) & (tcn < 1407))
qui replace `iog2003' = 66 if ((!`done') & (tcn >= 1407) & (tcn < 1409))
qui replace `done' = 1 if ((tcn >= 1407) & (tcn < 1409))
qui replace `iog2003' = 63 if ((!`done') & (tcn >= 1409) & (tcn < 1410))
qui replace `done' = 1 if ((tcn >= 1409) & (tcn < 1410))
qui replace `iog2003' = 58 if ((!`done') & (tcn >= 1410) & (tcn < 1411))
qui replace `done' = 1 if ((tcn >= 1410) & (tcn < 1411))
qui replace `iog2003' = 66 if ((!`done') & (tcn >= 1411) & (tcn < 1412))
qui replace `done' = 1 if ((tcn >= 1411) & (tcn < 1412))
qui replace `iog2003' = 67 if ((!`done') & (tcn >= 1412) & (tcn < 1413))
qui replace `done' = 1 if ((tcn >= 1412) & (tcn < 1413))
qui replace `iog2003' = 62 if ((!`done') & (tcn >= 1413) & (tcn < 1414))
qui replace `done' = 1 if ((tcn >= 1413) & (tcn < 1414))
qui replace `iog2003' = 66 if ((!`done') & (tcn >= 1414) & (tcn < 1416))
qui replace `done' = 1 if ((tcn >= 1414) & (tcn < 1416))
qui replace `iog2003' = 58 if ((!`done') & (tcn >= 1416) & (tcn < 1417))
qui replace `done' = 1 if ((tcn >= 1416) & (tcn < 1417))
qui replace `iog2003' = 57 if ((!`done') & (tcn >= 1417) & (tcn < 1418))
qui replace `done' = 1 if ((tcn >= 1417) & (tcn < 1418))
qui replace `iog2003' = 58 if ((!`done') & (tcn >= 1418) & (tcn < 1419))
qui replace `done' = 1 if ((tcn >= 1418) & (tcn < 1419))
qui replace `iog2003' = 63 if ((!`done') & (tcn >= 1419) & (tcn < 1498))
qui replace `done' = 1 if ((tcn >= 1419) & (tcn < 1498))
qui replace `iog2003' = 112 if ((!`done') & (tcn >= 1498) & (tcn < 1499))
qui replace `done' = 1 if ((tcn >= 1498) & (tcn < 1499))
qui replace `iog2003' = 63 if ((!`done') & (tcn >= 1499) & (tcn < 1500))
qui replace `done' = 1 if ((tcn >= 1499) & (tcn < 1500))
qui replace `iog2003' = 71 if ((!`done') & (tcn >= 1500) & (tcn < 1502))
qui replace `done' = 1 if ((tcn >= 1500) & (tcn < 1502))
qui replace `iog2003' = 70 if ((!`done') & (tcn >= 1502) & (tcn < 1503))
qui replace `done' = 1 if ((tcn >= 1502) & (tcn < 1503))
qui replace `iog2003' = 72 if ((!`done') & (tcn >= 1503) & (tcn < 1504))
qui replace `done' = 1 if ((tcn >= 1503) & (tcn < 1504))
qui replace `iog2003' = 74 if ((!`done') & (tcn >= 1504) & (tcn < 1505))
qui replace `done' = 1 if ((tcn >= 1504) & (tcn < 1505))
qui replace `iog2003' = 76 if ((!`done') & (tcn >= 1505) & (tcn < 1510))
qui replace `done' = 1 if ((tcn >= 1505) & (tcn < 1510))
qui replace `iog2003' = 69 if ((!`done') & (tcn >= 1510) & (tcn < 1512))
qui replace `done' = 1 if ((tcn >= 1510) & (tcn < 1512))
qui replace `iog2003' = 34 if ((!`done') & (tcn >= 1512) & (tcn < 1513))
qui replace `done' = 1 if ((tcn >= 1512) & (tcn < 1513))
qui replace `iog2003' = 75 if ((!`done') & (tcn >= 1513) & (tcn < 1514))
qui replace `done' = 1 if ((tcn >= 1513) & (tcn < 1514))
qui replace `iog2003' = 73 if ((!`done') & (tcn >= 1514) & (tcn < 1520))
qui replace `done' = 1 if ((tcn >= 1514) & (tcn < 1520))
qui replace `iog2003' = 68 if ((!`done') & (tcn >= 1520) & (tcn < 1521))
qui replace `done' = 1 if ((tcn >= 1520) & (tcn < 1521))
qui replace `iog2003' = 75 if ((!`done') & (tcn >= 1521) & (tcn < 1600))
qui replace `done' = 1 if ((tcn >= 1521) & (tcn < 1600))
qui replace `iog2003' = 77 if ((!`done') & (tcn >= 1600) & (tcn < 1700))
qui replace `done' = 1 if ((tcn >= 1600) & (tcn < 1700))
qui replace `iog2003' = 78 if ((!`done') & (tcn >= 1700) & (tcn < 1702))
qui replace `done' = 1 if ((tcn >= 1700) & (tcn < 1702))
qui replace `iog2003' = 79 if ((!`done') & (tcn >= 1702) & (tcn < 1706))
qui replace `done' = 1 if ((tcn >= 1702) & (tcn < 1706))
qui replace `iog2003' = 80 if ((!`done') & (tcn >= 1706) & (tcn < 1710))
qui replace `done' = 1 if ((tcn >= 1706) & (tcn < 1710))
qui replace `iog2003' = 84 if ((!`done') & (tcn >= 1710) & (tcn < 1711))
qui replace `done' = 1 if ((tcn >= 1710) & (tcn < 1711))
qui replace `iog2003' = 79 if ((!`done') & (tcn >= 1711) & (tcn < 1800))
qui replace `done' = 1 if ((tcn >= 1711) & (tcn < 1800))
qui replace `iog2003' = 76 if ((!`done') & (tcn >= 1800) & (tcn < 1900))
qui replace `done' = 1 if ((tcn >= 1800) & (tcn < 1900))
qui replace `iog2003' = 60 if ((!`done') & (tcn >= 1900) & (tcn < 1902))
qui replace `done' = 1 if ((tcn >= 1900) & (tcn < 1902))
qui replace `iog2003' = 61 if ((!`done') & (tcn >= 1902) & (tcn < 1903))
qui replace `done' = 1 if ((tcn >= 1902) & (tcn < 1903))
qui replace `iog2003' = 57 if ((!`done') & (tcn >= 1903) & (tcn < 1904))
qui replace `done' = 1 if ((tcn >= 1903) & (tcn < 1904))
qui replace `iog2003' = 60 if ((!`done') & (tcn >= 1904) & (tcn < 1906))
qui replace `done' = 1 if ((tcn >= 1904) & (tcn < 1906))
qui replace `iog2003' = 61 if ((!`done') & (tcn >= 1906) & (tcn < 1909))
qui replace `done' = 1 if ((tcn >= 1906) & (tcn < 1909))
qui replace `iog2003' = 68 if ((!`done') & (tcn >= 1909) & (tcn < 1910))
qui replace `done' = 1 if ((tcn >= 1909) & (tcn < 1910))
qui replace `iog2003' = 81 if ((!`done') & (tcn >= 1910) & (tcn < 1911))
qui replace `done' = 1 if ((tcn >= 1910) & (tcn < 1911))
qui replace `iog2003' = 59 if ((!`done') & (tcn >= 1911) & (tcn < 1912))
qui replace `done' = 1 if ((tcn >= 1911) & (tcn < 1912))
qui replace `iog2003' = 61 if ((!`done') & (tcn >= 1912) & (tcn < 1913))
qui replace `done' = 1 if ((tcn >= 1912) & (tcn < 1913))
qui replace `iog2003' = 56 if ((!`done') & (tcn >= 1913) & (tcn < 1914))
qui replace `done' = 1 if ((tcn >= 1913) & (tcn < 1914))
qui replace `iog2003' = 60 if ((!`done') & (tcn >= 1914) & (tcn < 2000))
qui replace `done' = 1 if ((tcn >= 1914) & (tcn < 2000))
qui replace `iog2003' = 10 if ((!`done') & (tcn >= 2000) & (tcn < 2002))
qui replace `done' = 1 if ((tcn >= 2000) & (tcn < 2002))
qui replace `iog2003' = 11 if ((!`done') & (tcn >= 2002) & (tcn < 2003))
qui replace `done' = 1 if ((tcn >= 2002) & (tcn < 2003))
qui replace `iog2003' = 10 if ((!`done') & (tcn >= 2003) & (tcn < 2004))
qui replace `done' = 1 if ((tcn >= 2003) & (tcn < 2004))
qui replace `iog2003' = 8 if ((!`done') & (tcn >= 2004) & (tcn < 2005))
qui replace `done' = 1 if ((tcn >= 2004) & (tcn < 2005))
qui replace `iog2003' = 9 if ((!`done') & (tcn >= 2005) & (tcn < 2007))
qui replace `done' = 1 if ((tcn >= 2005) & (tcn < 2007))
qui replace `iog2003' = 12 if ((!`done') & (tcn >= 2007) & (tcn < 2009))
qui replace `done' = 1 if ((tcn >= 2007) & (tcn < 2009))
qui replace `iog2003' = 14 if ((!`done') & (tcn >= 2009) & (tcn < 2010))
qui replace `done' = 1 if ((tcn >= 2009) & (tcn < 2010))
qui replace `iog2003' = 15 if ((!`done') & (tcn >= 2010) & (tcn < 2011))
qui replace `done' = 1 if ((tcn >= 2010) & (tcn < 2011))
qui replace `iog2003' = 11 if ((!`done') & (tcn >= 2011) & (tcn < 2012))
qui replace `done' = 1 if ((tcn >= 2011) & (tcn < 2012))
qui replace `iog2003' = 16 if ((!`done') & (tcn >= 2012) & (tcn < 2013))
qui replace `done' = 1 if ((tcn >= 2012) & (tcn < 2013))
qui replace `iog2003' = 13 if ((!`done') & (tcn >= 2013) & (tcn < 2014))
qui replace `done' = 1 if ((tcn >= 2013) & (tcn < 2014))
qui replace `iog2003' = 17 if ((!`done') & (tcn >= 2014) & (tcn < 2100))
qui replace `done' = 1 if ((tcn >= 2014) & (tcn < 2100))
qui replace `iog2003' = 18 if ((!`done') & (tcn >= 2100) & (tcn < 2104))
qui replace `done' = 1 if ((tcn >= 2100) & (tcn < 2104))
qui replace `iog2003' = 19 if ((!`done') & (tcn >= 2104) & (tcn < 2200))
qui replace `done' = 1 if ((tcn >= 2104) & (tcn < 2200))
qui replace `iog2003' = 20 if ((!`done') & (tcn >= 2200) & (tcn < 2300))
qui replace `done' = 1 if ((tcn >= 2200) & (tcn < 2300))
qui replace `iog2003' = 21 if ((!`done') & (tcn >= 2300) & (tcn < 2302))
qui replace `done' = 1 if ((tcn >= 2300) & (tcn < 2302))
qui replace `iog2003' = 27 if ((!`done') & (tcn >= 2302) & (tcn < 2303))
qui replace `done' = 1 if ((tcn >= 2302) & (tcn < 2303))
qui replace `iog2003' = 23 if ((!`done') & (tcn >= 2303) & (tcn < 2304))
qui replace `done' = 1 if ((tcn >= 2303) & (tcn < 2304))
qui replace `iog2003' = 25 if ((!`done') & (tcn >= 2304) & (tcn < 2305))
qui replace `done' = 1 if ((tcn >= 2304) & (tcn < 2305))
qui replace `iog2003' = 26 if ((!`done') & (tcn >= 2305) & (tcn < 2308))
qui replace `done' = 1 if ((tcn >= 2305) & (tcn < 2308))
qui replace `iog2003' = 48 if ((!`done') & (tcn >= 2308) & (tcn < 2309))
qui replace `done' = 1 if ((tcn >= 2308) & (tcn < 2309))
qui replace `iog2003' = 26 if ((!`done') & (tcn >= 2309) & (tcn < 2400))
qui replace `done' = 1 if ((tcn >= 2309) & (tcn < 2400))
qui replace `iog2003' = 29 if ((!`done') & (tcn >= 2400) & (tcn < 2406))
qui replace `done' = 1 if ((tcn >= 2400) & (tcn < 2406))
qui replace `iog2003' = 28 if ((!`done') & (tcn >= 2406) & (tcn < 2407))
qui replace `done' = 1 if ((tcn >= 2406) & (tcn < 2407))
qui replace `iog2003' = 29 if ((!`done') & (tcn >= 2407) & (tcn < 2500))
qui replace `done' = 1 if ((tcn >= 2407) & (tcn < 2500))
qui replace `iog2003' = 30 if ((!`done') & (tcn >= 2500) & (tcn < 2502))
qui replace `done' = 1 if ((tcn >= 2500) & (tcn < 2502))
qui replace `iog2003' = 28 if ((!`done') & (tcn >= 2502) & (tcn < 2510))
qui replace `done' = 1 if ((tcn >= 2502) & (tcn < 2510))
qui replace `iog2003' = 24 if ((!`done') & (tcn >= 2510) & (tcn < 2512))
qui replace `done' = 1 if ((tcn >= 2510) & (tcn < 2512))
qui replace `iog2003' = 28 if ((!`done') & (tcn >= 2512) & (tcn < 2600))
qui replace `done' = 1 if ((tcn >= 2512) & (tcn < 2600))
qui replace `iog2003' = 31 if ((!`done') & (tcn >= 2600) & (tcn < 2606))
qui replace `done' = 1 if ((tcn >= 2600) & (tcn < 2606))
qui replace `iog2003' = 84 if ((!`done') & (tcn >= 2606) & (tcn < 2607))
qui replace `done' = 1 if ((tcn >= 2606) & (tcn < 2607))
qui replace `iog2003' = 31 if ((!`done') & (tcn >= 2607) & (tcn < 2609))
qui replace `done' = 1 if ((tcn >= 2607) & (tcn < 2609))
qui replace `iog2003' = 81 if ((!`done') & (tcn >= 2609) & (tcn < 2700))
qui replace `done' = 1 if ((tcn >= 2609) & (tcn < 2700))
qui replace `iog2003' = 32 if ((!`done') & (tcn >= 2700) & (tcn < 2702))
qui replace `done' = 1 if ((tcn >= 2700) & (tcn < 2702))
qui replace `iog2003' = 33 if ((!`done') & (tcn >= 2702) & (tcn < 2707))
qui replace `done' = 1 if ((tcn >= 2702) & (tcn < 2707))
qui replace `iog2003' = 34 if ((!`done') & (tcn >= 2707) & (tcn < 2800))
qui replace `done' = 1 if ((tcn >= 2707) & (tcn < 2800))
qui replace `iog2003' = 47 if ((!`done') & (tcn >= 2800) & (tcn < 2804))
qui replace `done' = 1 if ((tcn >= 2800) & (tcn < 2804))
qui replace `iog2003' = 48 if ((!`done') & (tcn >= 2804) & (tcn < 2900))
qui replace `done' = 1 if ((tcn >= 2804) & (tcn < 2900))
qui replace `iog2003' = 82 if ((!`done') & (tcn >= 2900) & (tcn < 2903))
qui replace `done' = 1 if ((tcn >= 2900) & (tcn < 2903))
qui replace `iog2003' = 83 if ((!`done') & (tcn >= 2903) & (tcn < 2904))
qui replace `done' = 1 if ((tcn >= 2903) & (tcn < 2904))
qui replace `iog2003' = 84 if ((!`done') & (tcn >= 2904) & (tcn < 2905))
qui replace `done' = 1 if ((tcn >= 2904) & (tcn < 2905))
qui replace `iog2003' = 67 if ((!`done') & (tcn >= 2905) & (tcn < 2906))
qui replace `done' = 1 if ((tcn >= 2905) & (tcn < 2906))
qui replace `iog2003' = 84 if ((!`done') & (tcn >= 2906) & (tcn < 3000))
qui replace `done' = 1 if ((tcn >= 2906) & (tcn < 3000))
qui replace `iog2003' = 88 if ((!`done') & (tcn >= 3000) & (tcn < 3100))
qui replace `done' = 1 if ((tcn >= 3000) & (tcn < 3100))
qui replace `iog2003' = 124 if ((!`done') & (tcn >= 3100) & (tcn < 3500))
qui replace `done' = 1 if ((tcn >= 3100) & (tcn < 3500))
qui replace `iog2003' = 90 if ((!`done') & (tcn >= 3500) & (tcn < 3600))
qui replace `done' = 1 if ((tcn >= 3500) & (tcn < 3600))
qui replace `iog2003' = 91 if ((!`done') & (tcn >= 3600) & (tcn < 3700))
qui replace `done' = 1 if ((tcn >= 3600) & (tcn < 3700))
qui replace `iog2003' = 89 if ((!`done') & (tcn >= 3700) & (tcn < 3800))
qui replace `done' = 1 if ((tcn >= 3700) & (tcn < 3800))
qui replace `iog2003' = 92 if ((!`done') & (tcn >= 3800) & (tcn < 3900))
qui replace `done' = 1 if ((tcn >= 3800) & (tcn < 3900))
qui replace `iog2003' = 124 if ((!`done') & (tcn >= 3900) & (tcn < 4000))
qui replace `done' = 1 if ((tcn >= 3900) & (tcn < 4000))
qui replace `iog2003' = 94 if ((!`done') & (tcn >= 4000) & (tcn < 4100))
qui replace `done' = 1 if ((tcn >= 4000) & (tcn < 4100))
qui replace `iog2003' = 95 if ((!`done') & (tcn >= 4100) & (tcn < 4200))
qui replace `done' = 1 if ((tcn >= 4100) & (tcn < 4200))
qui replace `iog2003' = 93 if ((!`done') & (tcn >= 4200) & (tcn < 4203))
qui replace `done' = 1 if ((tcn >= 4200) & (tcn < 4203))
qui replace `iog2003' = 94 if ((!`done') & (tcn >= 4203) & (tcn < 4207))
qui replace `done' = 1 if ((tcn >= 4203) & (tcn < 4207))
qui replace `iog2003' = 95 if ((!`done') & (tcn >= 4207) & (tcn < 4208))
qui replace `done' = 1 if ((tcn >= 4207) & (tcn < 4208))
qui replace `iog2003' = 96 if ((!`done') & (tcn >= 4208) & (tcn < 4209))
qui replace `done' = 1 if ((tcn >= 4208) & (tcn < 4209))
qui replace `iog2003' = 97 if ((!`done') & (tcn >= 4209) & (tcn < 4215))
qui replace `done' = 1 if ((tcn >= 4209) & (tcn < 4215))
qui replace `iog2003' = 94 if ((!`done') & (tcn >= 4215) & (tcn < 4216))
qui replace `done' = 1 if ((tcn >= 4215) & (tcn < 4216))
qui replace `iog2003' = 97 if ((!`done') & (tcn >= 4216) & (tcn < 4217))
qui replace `done' = 1 if ((tcn >= 4216) & (tcn < 4217))
qui replace `iog2003' = 94 if ((!`done') & (tcn >= 4217) & (tcn < 4300))
qui replace `done' = 1 if ((tcn >= 4217) & (tcn < 4300))
qui replace `iog2003' = 98 if ((!`done') & (tcn >= 4300) & (tcn < 4302))
qui replace `done' = 1 if ((tcn >= 4300) & (tcn < 4302))
qui replace `iog2003' = 99 if ((!`done') & (tcn >= 4302) & (tcn < 4400))
qui replace `done' = 1 if ((tcn >= 4302) & (tcn < 4400))
qui replace `iog2003' = 124 if ((!`done') & (tcn >= 4400) & (tcn < 5000))
qui replace `done' = 1 if ((tcn >= 4400) & (tcn < 5000))
qui replace `iog2003' = 100 if ((!`done') & (tcn >= 5000) & (tcn < 5500))
qui replace `done' = 1 if ((tcn >= 5000) & (tcn < 5500))
qui replace `iog2003' = 102 if ((!`done') & (tcn >= 5500) & (tcn < 5504))
qui replace `done' = 1 if ((tcn >= 5500) & (tcn < 5504))
qui replace `iog2003' = 100 if ((!`done') & (tcn >= 5504) & (tcn < 5506))
qui replace `done' = 1 if ((tcn >= 5504) & (tcn < 5506))
qui replace `iog2003' = 102 if ((!`done') & (tcn >= 5506) & (tcn < 5700))
qui replace `done' = 1 if ((tcn >= 5506) & (tcn < 5700))
qui replace `iog2003' = 102 if ((!`done') & (tcn >= 5700) & (tcn < 5800))
qui replace `done' = 1 if ((tcn >= 5700) & (tcn < 5800))
qui replace `iog2003' = 102 if ((!`done') & (tcn >= 5800) & (tcn < 6000))
qui replace `done' = 1 if ((tcn >= 5800) & (tcn < 6000))
qui replace `iog2003' = 109 if ((!`done') & (tcn >= 6000) & (tcn < 6200))
qui replace `done' = 1 if ((tcn >= 6000) & (tcn < 6200))
qui replace `iog2003' = 110 if ((!`done') & (tcn >= 6200) & (tcn < 6300))
qui replace `done' = 1 if ((tcn >= 6200) & (tcn < 6300))
qui replace `iog2003' = 112 if ((!`done') & (tcn >= 6300) & (tcn < 6500))
qui replace `done' = 1 if ((tcn >= 6300) & (tcn < 6500))
qui replace `iog2003' = 108 if ((!`done') & (tcn >= 6500) & (tcn < 6502))
qui replace `done' = 1 if ((tcn >= 6500) & (tcn < 6502))
qui replace `iog2003' = 112 if ((!`done') & (tcn >= 6502) & (tcn < 6600))
qui replace `done' = 1 if ((tcn >= 6502) & (tcn < 6600))
qui replace `iog2003' = 113 if ((!`done') & (tcn >= 6600) & (tcn < 6603))
qui replace `done' = 1 if ((tcn >= 6600) & (tcn < 6603))
qui replace `iog2003' = 107 if ((!`done') & (tcn >= 6603) & (tcn < 6605))
qui replace `done' = 1 if ((tcn >= 6603) & (tcn < 6605))
qui replace `iog2003' = 114 if ((!`done') & (tcn >= 6605) & (tcn < 6606))
qui replace `done' = 1 if ((tcn >= 6605) & (tcn < 6606))
qui replace `iog2003' = 111 if ((!`done') & (tcn >= 6606) & (tcn < 6609))
qui replace `done' = 1 if ((tcn >= 6606) & (tcn < 6609))
qui replace `iog2003' = 114 if ((!`done') & (tcn >= 6609) & (tcn < 6615))
qui replace `done' = 1 if ((tcn >= 6609) & (tcn < 6615))
qui replace `iog2003' = 110 if ((!`done') & (tcn >= 6615) & (tcn < 6616))
qui replace `done' = 1 if ((tcn >= 6615) & (tcn < 6616))
qui replace `iog2003' = 114 if ((!`done') & (tcn >= 6616) & (tcn < 6700))
qui replace `done' = 1 if ((tcn >= 6616) & (tcn < 6700))
qui replace `iog2003' = 124 if ((!`done') & (tcn >= 6700) & (tcn < 7000))
qui replace `done' = 1 if ((tcn >= 6700) & (tcn < 7000))
qui replace `iog2003' = 106 if ((!`done') & (tcn >= 7000) & (tcn < 7200))
qui replace `done' = 1 if ((tcn >= 7000) & (tcn < 7200))
qui replace `iog2003' = 104 if ((!`done') & (tcn >= 7200) & (tcn < 7204))
qui replace `done' = 1 if ((tcn >= 7200) & (tcn < 7204))
qui replace `iog2003' = 105 if ((!`done') & (tcn >= 7204) & (tcn < 7300))
qui replace `done' = 1 if ((tcn >= 7204) & (tcn < 7300))
qui replace `iog2003' = 124 if ((!`done') & (tcn >= 7300) & (tcn < 7500))
qui replace `done' = 1 if ((tcn >= 7300) & (tcn < 7500))
qui replace `iog2003' = 117 if ((!`done') & (tcn >= 7500) & (tcn < 7710))
qui replace `done' = 1 if ((tcn >= 7500) & (tcn < 7710))
qui replace `iog2003' = 116 if ((!`done') & (tcn >= 7710) & (tcn < 7800))
qui replace `done' = 1 if ((tcn >= 7710) & (tcn < 7800))
qui replace `iog2003' = 120 if ((!`done') & (tcn >= 7800) & (tcn < 7804))
qui replace `done' = 1 if ((tcn >= 7800) & (tcn < 7804))
qui replace `iog2003' = 118 if ((!`done') & (tcn >= 7804) & (tcn < 7900))
qui replace `done' = 1 if ((tcn >= 7804) & (tcn < 7900))
qui replace `iog2003' = 120 if ((!`done') & (tcn >= 7900) & (tcn < 8000))
qui replace `done' = 1 if ((tcn >= 7900) & (tcn < 8000))
qui replace `iog2003' = 121 if ((!`done') & (tcn >= 8000) & (tcn < 8100))
qui replace `done' = 1 if ((tcn >= 8000) & (tcn < 8100))
qui replace `iog2003' = 122 if ((!`done') & (tcn >= 8100) & (tcn < 8202))
qui replace `done' = 1 if ((tcn >= 8100) & (tcn < 8202))
qui replace `iog2003' = 119 if ((!`done') & (tcn >= 8202) & (tcn < 8205))
qui replace `done' = 1 if ((tcn >= 8202) & (tcn < 8205))
qui replace `iog2003' = 114 if ((!`done') & (tcn >= 8205) & (tcn < 8208))
qui replace `done' = 1 if ((tcn >= 8205) & (tcn < 8208))
qui replace `iog2003' = 122 if ((!`done') & (tcn >= 8208) & (tcn < 8209))
qui replace `done' = 1 if ((tcn >= 8208) & (tcn < 8209))
qui replace `iog2003' = 114 if ((!`done') & (tcn >= 8209) & (tcn < 8210))
qui replace `done' = 1 if ((tcn >= 8209) & (tcn < 8210))
qui replace `iog2003' = 122 if ((!`done') & (tcn >= 8210) & (tcn < 8212))
qui replace `done' = 1 if ((tcn >= 8210) & (tcn < 8212))
qui replace `iog2003' = 88 if ((!`done') & (tcn >= 8212) & (tcn < 8213))
qui replace `done' = 1 if ((tcn >= 8212) & (tcn < 8213))
qui replace `iog2003' = 122 if ((!`done') & (tcn >= 8213) & (tcn < 8214))
qui replace `done' = 1 if ((tcn >= 8213) & (tcn < 8214))
qui replace `iog2003' = 123 if ((!`done') & (tcn >= 8214) & (tcn < 8300))
qui replace `done' = 1 if ((tcn >= 8214) & (tcn < 8300))
qui replace `iog2003' = 124 if (!`done')
qui replace `done' = 1
assert (`iog2003' < .)

qui gen byte industry = .
qui replace industry = 1 if (`iog2003' > 0) & (`iog2003' < 4) & (industry == .)
qui replace industry = 2 if (`iog2003' > 7) & (`iog2003' < 88) & (industry == .)
qui replace industry = 3 if (`iog2003' > 87) & (`iog2003' < 89) & (industry == .)
qui replace industry = 4 if (`iog2003' > 88) & (`iog2003' < 92) & (industry == .)
qui replace industry = 5 if (`iog2003' > 91) & (`iog2003' < 93) & (industry == .)
qui replace industry = 6 if (`iog2003' > 92) & (`iog2003' < 100) & (industry == .)
qui replace industry = 7 if (`iog2003' > 108) & (`iog2003' < 111) & (industry == .)
qui replace industry = 8 if (`iog2003' > 99) & (`iog2003' < 115) & (industry == .)
qui replace industry = 9 if (`iog2003' > 115) & (`iog2003' < 119) & (industry == .)
qui replace industry = 10 if (((`iog2003' > 0) & (`iog2003' < 124)) | ((`iog2003' > 130) & (`iog2003' < 137))) & (industry == .)
qui replace industry = 11 if (`iog2003' == 124) & (industry == .)
assert (industry < .)

label define industry 1 "Agriculture" 2 "Manufacturing" 3 "Construction" 4 "Wholesale" 5 "Hotels" 6 "Transport" 7 "Legal" 8 "Financial" 9 "Education" 10 "Other" 11 "Unknown"
label values industry industry
